package com.hontech.pastacooking.app

import android.Manifest
import android.app.Application
import android.content.Context
import android.content.ContextWrapper
import com.hontech.pastacooking.net.ConnectTask
import com.hontech.pastacooking.task.conn.runKeepTask

private lateinit var INSTANCE: Context

const val AppId = "com.hontech.pastacooking"
const val AppActivityId = "com.hontech.pastacooking.activity.MainActivity"

object AppContext : ContextWrapper(INSTANCE)

class PastaCookingApp : Application() {

    override fun onCreate() {
        super.onCreate()
        INSTANCE = this
        init()
    }

    private fun checkPermission() {
        checkAndGrantPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)
        checkAndGrantPermission(Manifest.permission.READ_EXTERNAL_STORAGE)
    }

    private fun init() {
        log("设备mac地址:$MacAddr")
      //  checkPermission()
        ConnectTask.connect()
        runKeepTask()
    }
}

